#ifndef __NET_H
#define __NET_H

#include<stdio.h>
#include<stdlib.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include<sys/socket.h>
#include<unistd.h>
#include<event2/event.h>
#include<event2/listener.h>
#include<event2/bufferevent.h>
#include<string.h>
#include<pthread.h>

void listener_cb(struct evconnlistener *listener, evutil_socket_t fd,
                 struct sockaddr *sock, int socklen, void *arg);

void socket_read_cb(struct bufferevent *bev, void *arg);
void socket_event_cb(struct bufferevent *bev, short events, void *arg);

int delServerRecv(struct bufferevent *bev,u_int16_t cmd,u_int32_t packet_len,char *buf);
int user_confirmation(struct bufferevent *bev,void *buf,u_int32_t packet_len);
int check_timestamp(struct bufferevent *bev,void *buf,u_int32_t packet_len);
void send_update_timestamp(struct bufferevent *bev,u_int32_t position);
int return_timestamp(struct bufferevent *bev,void *buf,u_int32_t packet_len);


#endif  //__NET_H